package com.jlnk.androidfmc.database;

        import android.content.Context;
        import android.database.sqlite.SQLiteDatabase;
        import android.database.sqlite.SQLiteOpenHelper;

        import com.jlnk.androidfmc.entity.Product;

public class CategoryDatabaseHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "productDatabase";
    private static final int DATABASE_VERSION = 1;
    private static final String TABLE_PRODUCTS = "products";

    private static final String COLUMN_ID = "id";
    private static final String COLUMN_NAME = "name";
    private static final String COLUMN_DESCRIPTION = "description";
    private static final String COLUMN_IMAGE_PATH = "image_path";
    private static final String COLUMN_CATEGORY = "category";
    private static final String COLUMN_PRICE = "price";

    private static final String CREATE_TABLE_PRODUCTS = "CREATE TABLE "
            + TABLE_PRODUCTS + "("
            + COLUMN_ID + " TEXT,"
            + COLUMN_NAME + " TEXT PRIMARY KEY,"
            + COLUMN_DESCRIPTION + " TEXT,"
            + COLUMN_IMAGE_PATH + " TEXT,"
            + COLUMN_CATEGORY + " TEXT,"
            + COLUMN_PRICE + " REAL"
            + ")";

    public CategoryDatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_PRODUCTS);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_PRODUCTS);
        onCreate(db);
    }
}